package test.pcs;

import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapServiceV20;
import com.payment.lc.pcs.common.enums.BizType;
import com.payment.lc.pcs.common.enums.DisplayType;
import com.payment.lc.pcs.common.enums.GroupType;
import com.payment.lc.pcs.common.enums.MiProductCategory;
import com.payment.lc.pcs.common.enums.n.MiProductMainCategory;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.ProductionServiceV20;
import com.payment.lc.pcs.service.api.nocache.PcsQueryService;
import com.payment.lc.pcs.service.bo.ProductionSellInfo;
import com.payment.lc.pcs.service.domain.InsuranceProductionV2;
import com.payment.lc.pcs.service.domain.ListWrapper;
import com.payment.lc.pcs.service.domain.Production;
import com.payment.lc.pcs.service.domain.YueGuJiaoProduction;
import com.payment.lc.pcs.service.request.GetProductsReq;
import com.payment.lc.pcs.service.response.PcsCommonPageResp;
import net.rubyeye.xmemcached.MemcachedClient;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import test.BaseTest;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

/**
 * Created on 2016/8/8.
 */
public class Demo2PcsTest5 extends BaseTest {

    @Autowired
    ProductionService productionService;

    @Autowired
    ProductionWrapService productionWrapService;

    @Autowired
    ProductionServiceV20 productionServiceV20;
    @Autowired
    ProductionWrapServiceV20 productionWrapServiceV20;

    @Resource(name = "pcsCommonMemeryClient")
    private MemcachedClient pcsCommonMemeryClient;
    @Autowired
    private DynamicDataService dynamicDataService;
    @Autowired
    PcsQueryService pcsQueryService;


    @Test
    public void test() throws Exception {
        test5();
    }


    void test5() {
        GetProductsReq req = new GetProductsReq();
        req.setStart(10);
        req.setLimit(20);
        req.setMiMainCategory(MiProductMainCategory.FI);
        ArrayList<String> exclude = new ArrayList<>();
        exclude.add("FI16014");
//        req.setExcludeProducts(exclude);
//        req.setMiCategory(MiProductCategory.YueGuJiao);
        PcsCommonPageResp<String> resp = pcsQueryService.getProductsByCategories(req);
        display(resp);
    }

    void test4() throws Exception {
        Production production = productionWrapService.getProduction("002379");
        display(production);
    }

    void test2() throws Exception {
        InsuranceProductionV2 insuranceV2 = productionService.getInsuranceV2("FP16003");
        display(insuranceV2);
    }
    void test1() throws Exception {
        YueGuJiaoProduction po = productionService.getYueGuJiao("KT10005");
        display(po);
    }
    void test3() throws Exception {
//        Object production = productionService.getBiz("test", BizType.Fundin);
//        display(production);
        ListWrapper<String> codes = productionServiceV20.getProdCodesByCategoryDisplayType(MiProductCategory.Dingqi, DisplayType.Up);
        display(codes);
        HashSet<MiProductCategory> miProductCategories = new HashSet<>();
        HashSet<DisplayType> displayTypes = new HashSet<>();
        miProductCategories.add(MiProductCategory.Dingqi);
        displayTypes.add(DisplayType.Up);
        List<Production> productions = productionWrapServiceV20.getProductionsByCategoryDisplayType(miProductCategories, displayTypes);
        display(productions);
    }
}